<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>DI_COMBOBOX</title>
<meta http-equiv="Content-Type" Content="text/html; charset=utf-8">
<link rel="stylesheet" type="text/css" href="../../../styles/styles.css">
<script language="javascript" src='../../links.js' type="text/javascript"></script>
</head>
<body>

<h1>DI_COMBOBOX</h1>
<div class=navbar>
<a href="../../index.html">main</a> |
<a href="../index.html">Dialog API</a> |
<a href="index.html">Dialog items</a><br>
</div>

<div class=shortdescr>
The <dfn>DI_COMBOBOX</dfn> dialog item describes an edit box with a drop-down list (Combo Box).
</div>

<pre class=syntax>
struct FarDialogItem
{
  int Type             = <b>DI_COMBOBOX</b>
  int X1               = <b>X1</b>
  int Y1               = <b>Y</b>
  int X2               = <b>X2</b>
  int Y2               = <b>Y</b> (equals to Y1)
  int Focus            = <b>Focus</b>
  union {
    FarList *ListItems = <b>ListItems</b>  [passed to]
    int ListPos        = <b>ListPos</b>    [returned]
  };
  DWORD Flags          = <b>Flags</b>
  int DefaultButton    = <b>DefaultButton</b>
  union {
    char Data[512];    = <b>the text for editing (without <a href="../flags/dif_varedit.html">DIF_VAREDIT</a>)</b>
    struct {
      DWORD PtrFlags;  = <b>advanced flags (not used in Dialog API 1.0)</b>
      int   PtrLength; = <b>size of the user buffer pointed by PtrData</b>
      char *PtrData;   = <b>the pointer to the user buffer</b>
      char  PtrTail[1];= <b>the remainder part of Data</b>
    } Ptr;             = <b><b>the text for editing </b>(with <a href="../flags/dif_varedit.html">DIF_VAREDIT</a>)</b>
  };
};
</pre>
<p class=note><img src="../../../images/note.gif" alt="Attention!" width="10" height="10"> Attention!</p>
<UL class=note>
  <LI>This is an exemplary structure; read full description <a href="../structures/fardialogitem.html">here</a>.</LI>
</UL>

<h3>Focus</h3>
<div class=descr>
Keyboard focus flag.</div>

<h3>ListItems</h3>
<div class=descr>
<p>This is the pointer to the <a href="../structures/farlist.html">FarList</a> structure containing fields for the combo box initialization.
The &quot;edit&quot; part of the combo box gets the value of the first item in the list with the <a href="../structures/farlistitem.html#LIF_SELECTED">LIF_SELECTED</a>
flag set, if any.
<p>If this field is set to NULL, then the list box will not be shown.
</div>

<h3>ListPos</h3>
<div class=descr>
<p>Current position in the <a href="../structures/farlist.html">ListItems.Items</a> list.
The index of the item selected by the user is stored in this field after the dialog has been closed.
</div>

<h3>Flags</h3>
<div class=descr>
There are several flags applicable to the <dfn>DI_COMBOBOX</dfn> control (for the flags of the list box, see <a href="../structures/farlistitem.html">FarListItem</a>):<br>
<table class="cont">
<tr class="cont"><th class="cont" width="40%">Flag</th><th class="cont" width="60%">Description</th></tr>
 <tr class="cont"><td class="cont" width="40%"><a href="../flags/dif_dropdownlist.html">DIF_DROPDOWNLIST</a></td>
 <td class="cont" width="60%">Shows non-editable drop-down list instead of a common combo box.</td>
 </tr>
 <tr class="cont"><td class="cont" width="40%"><a href="../flags/dif_editexpand.html">DIF_EDITEXPAND</a></td>
 <td class="cont" width="60%">Expand environment variables.
</td>
 </tr>
 <tr class="cont"><td class="cont" width="40%"><a href="../flags/dif_listautohighlight.html">DIF_LISTAUTOHIGHLIGHT</a></td>
 <td class="cont" width="60%">Assigns hotkeys for the list elements automatically, starting with the first item.</td>
 </tr>
 <tr class="cont"><td class="cont" width="40%"><a href="../flags/dif_listnoampersand.html">DIF_LISTNOAMPERSAND</a></td>
 <td class="cont" width="60%">Shows a hotkey instead of showing the ampersand itself.</td>
 </tr>
 <tr class="cont"><td class="cont" width="40%"><a href="../flags/dif_listwrapmode.html">DIF_LISTWRAPMODE</a></td>
 <td class="cont" width="60%">If this flag is set, trying to move the cursor up from the first element or down from the last element will move the cursor to the bottom or the top of the list, respectively.</td>
 </tr>
 <tr class="cont"><td class="cont" width="40%"><a href="../flags/dif_disable.html">DIF_DISABLE</a></td>
 <td class="cont" width="60%">Disables user access to the combo box.</td>
 </tr>
 <tr class="cont"><td class="cont" width="40%"><a href="../flags/dif_readonly.html">DIF_READONLY</a></td>
 <td class="cont" width="60%">Sets read-only state for the edit control.
 </td>
 </tr>
 <tr class="cont"><td class="cont" width="40%"><a href="../flags/dif_selectonentry.html">DIF_SELECTONENTRY</a></td>
 <td class="cont" width="60%">Makes the edit control always select the text when it receives focus.</td>
 </tr>
 <tr class="cont"><td class="cont" width="40%"><a href="../flags/dif_nofocus.html">DIF_NOFOCUS</a></td>
 <td class="cont" width="60%">The dialog item cannot receive keyboard focus, but can handle other user events.</td>
 </tr>
 <tr class="cont"><td class="cont" width="40%"><a href="../flags/dif_varedit.html">DIF_VAREDIT</a></td>
 <td class="cont" width="60%">If this flag is set, the dialog manager will use only the Ptr.* members instead of Data in the FarDialogItem structure. The use of this flag allows to exceed the 512-byte limit for the edit control.</td>
 </tr>
</table>
</div>

<h3>Events</h3>
<div class=descr>
<table class="cont">
<tr class="cont"><th class="cont" width="40%">Event</th><th class="cont" width="60%">Description</th></tr>

 <tr class="cont"><td class="cont" width="40%"><a href="../dmsg/dn_drawdlgitem.html">DN_DRAWDLGITEM</a></td>
 <td class="cont" width="60%">This event is sent to the dialog callback function before the combo box  is drawn.</td>
 </tr>
 <tr class="cont"><td class="cont" width="40%"><a href="../dmsg/dn_ctlcolordlgitem.html">DN_CTLCOLORDLGITEM</a></td>
   <td class="cont" width="60%">Plugin should pass the color attributes of the edit item of the combo box when this event comes. Param2 parameter:
      <pre>LoWord LoByte - color of the text in the edit control
                (<a href="../../defs/farcolors.html#COL_WARNDIALOGEDIT">COL_WARNDIALOGEDIT</a> or
                 <a href="../../defs/farcolors.html#COL_DIALOGEDIT">COL_DIALOGEDIT</a>)
LoWord HiByte - color of selected text
                (<a href="../../defs/farcolors.html#COL_DIALOGEDITSELECTED">COL_DIALOGEDITSELECTED</a>)
HiWord LoByte - color of unchanged text
                (<a href="../../defs/farcolors.html#COL_DIALOGEDITUNCHANGED">COL_DIALOGEDITUNCHANGED</a>)
HiWord HiByte - color of the drop-down arrow
                (<a href="../../defs/farcolors.html#COL_DIALOGTEXT">COL_DIALOGTEXT</a>)
</pre>      </td></tr>
 <tr class="cont"><td class="cont" width="40%"><a href="../dmsg/dn_ctlcolordlglist.html">DN_CTLCOLORDLGLIST</a></td>
 <td class="cont" width="60%">When this event comes, the plugin may change the color attributes of the list item of the combo box to be drawn.</td>
 </tr>
 <tr class="cont"><td class="cont" width="40%"><a href="../dmsg/dn_key.html">DN_KEY</a></td>
 <td class="cont" width="60%">This event comes after the user has pressed a key in the dialog.</td>
 </tr>
 <tr class="cont"><td class="cont" width="40%"><a href="../dmsg/dn_mouseclick.html">DN_MOUSECLICK</a></td>
 <td class="cont" width="60%">This event comes after the user has clicked one of the dialog items or outside the dialog with the mouse button.</td>
 </tr>
 <tr class="cont"><td class="cont" width="40%"><a href="../dmsg/dn_editchange.html">DN_EDITCHANGE</a></td>
 <td class="cont" width="60%">The text in the edit field has been changed.</td>
 </tr>
 <tr class="cont"><td class="cont" width="40%"><a href="../dmsg/dn_killfocus.html">DN_KILLFOCUS</a></td>
 <td class="cont" width="60%">This event is sent before the combo box loses the focus, if the flag <a href="../flags/dif_nofocus.html">DIF_NOFOCUS</a> was not used.</td>
 </tr>
 <tr class="cont"><td class="cont" width="40%"><a href="../dmsg/dn_gotfocus.html">DN_GOTFOCUS</a></td>
 <td class="cont" width="60%">This event is sent after the button has received the keyboard focus, if the flag <a href="../flags/dif_nofocus.html">DIF_NOFOCUS</a> was not used.</td>
 </tr>

</table>

</div>

<h3>Remarks</h3>
<div class=descr>
<p></p>
</div>


<div class=see>See also:</div><div class=seecont>
<a href="di_listbox.html">DI_LISTBOX</a>,
<a href="../structures/fardialogitem.html">FarDialogItem</a>

</div>

</body>
</html>